/*******************************************************************************
* Project: QSAR(Cute Software Architecture)
*
* Copyright: Copyright(C) 2024 by YuetingBen, All Rights Reserved
*
* File name: ComStackType.h
*
* Brief: ;
*
* Author: Yueting.Ben
*
* Module: ComStack
*
*******************************************************************************/

#ifndef COMSTACKTYPE_H
#define COMSTACKTYPE_H

/** HEADER FILES **/
#include "PlatformCfg.h" 


/** MACRO DEFINITION **/


/** TYPEDEF DEFINITION **/

/* Variables of this type shall be used to store the result of a buffer request. */
typedef enum
{
    BUFREQ_OK,       /* Buffer request accomplished successful. */
    BUFREQ_E_NOT_OK, /* Buffer request not successful. Buffer cannot be accessed. */
    BUFREQ_E_BUSY,   /* Temporarily no buffer available. It's up the requestor to retry request for a certain time. */
    BUFREQ_E_OVFL    /* No Buffer of the required length can be provided. */
}BufReq_ReturnType;


/* Variables of this type shall be used to store the basic information about a PDU of any  type, namely a pointer 
variable pointing to its SDU (payload), a pointer to Meta Data of the PDU, and the corresponding length of the SDU 
in bytes. */
typedef struct
{
    uint8* SduDataPtr;
    uint16 SduLength;
}PduInfoType;

/* This type is used within the entire AUTOSAR Com Stack except for bus drivers. */
typedef uint8 PduIdType;

/* This type shall be used within the entire AUTOSAR Com Stack of an ECU except for bus drivers. */
typedef uint16 PduLengthType;

typedef enum
{
    TP_DATACONF = 0x00u,     /* TP_DATACONF indicates that all data, that have been copied so far, are confirmed and can be
                                                  removed from the TP buffer. Data copied by this API call are excluded and will be confirmed later. */
    TP_DATARETRY,    /* TP_DATARETRY indicates that this API call shall copy already copied data in order to recover from
                                     an error. In this case TxTpDataCnt specifies the offset of the first byte to be copied by the API call. */
    TP_CONFPENDING
}TpDataStateType;

typedef struct
{
    TpDataStateType TpDataState;
    PduLengthType TxTpDataCnt;
}RetryInfoType;

/* Variables of the type NetworkHandleType shall be used to store the identifier of a communication channel */
typedef uint8 NetworkHandleType;

/* Used to store the identifier of a partial network cluster */
typedef uint8 PNCHandleType;

/* Specify the parameter to which the value has to be changed (BS or STmin) */
typedef uint8 TPParameterType;
/* Separation Time */
#define TP_STMIN ((TPParameterType)0x00)
/* Block Size */
#define TP_BS ((TPParameterType)0x01)
/* The Band width control parameter used in FlexRay transport protocol module */
#define TP_BC ((TPParameterType)0x02)


#endif

